/*
 * @Author: _LJP 2634716776@qq.com
 * @Date: 2023-12-22 20:11:39
 * @LastEditors: _LJP 2634716776@qq.com
 * @LastEditTime: 2023-12-23 15:33:59
 * @FilePath: /my_-linux/Pro23/Test1222/progressbar.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <cstdio>

#define NUM 51

int main()
{
    char bar[NUM];
    memset(bar, 0, sizeof(bar)); 
    std::string C("|/-\\");
    int cnt = 0;

    while (cnt < NUM)
    {
        printf("[%-50s][%3d%%][%c]\r", bar, cnt * 2, C[cnt % 4]); 
        fflush(stdout);
        bar[cnt++] = '='; 
        usleep(100000);
    }

    std::cout << std::endl;

    return 0;
}
